package cn.kone.service.impl;

import cn.kone.domain.Teacher;
import cn.kone.mapper.TeacherMapper;
import cn.kone.query.BaseQuery;
import cn.kone.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class TeacherServiceImpl implements ITeacherService {

    @Autowired
    private TeacherMapper teacherMapper;

    @Override
    public List<Teacher> findAllTeachers() {

        List<Teacher> teacherList = teacherMapper.findAllTeachers();


        return teacherList;
    }

    @Override
    public Teacher findOneByIdTeacher(Long id) {

        Teacher teacher = teacherMapper.findOneByIdTeacher(id);
        return teacher;
    }

    @Override
    public void addTeacher(Teacher teacher) {
        teacherMapper.addTeacher(teacher);
    }

    @Override
    public void updateTeacher(Teacher teacher) {
        teacherMapper.updateTeacher(teacher);
    }

    @Override
    public void batchAddTeacher(List<Teacher> teacherList) {
        teacherMapper.batchAddTeacher(teacherList);
    }

    @Override
    public void deleteTeacher(Long id) {
        teacherMapper.deleteTeacher(id);
    }

    @Override
    public void batchdeleteTeacher(Long[] ids) {
        teacherMapper.batchdeleteTeacher(ids);
    }

    @Override
    public Teacher findQueryTeacher(BaseQuery baseQuery) {

        Teacher queryTeacher = teacherMapper.findQueryTeacher(baseQuery);
        return queryTeacher;
    }
}
